package com.zang.linkedlist;

/**
 * @author ZVerify
 * @since 2022/10/10 20:39
 * @see <a href="https://leetcode.cn/problems/reverse-linked-list/">...</a>
 **/
public class 翻转链表 {

    public ListNode reverseList(ListNode head) {


        ListNode temp = null;

        ListNode cur = head;
        ListNode pre = null;

        while (cur!=null){

            temp = cur.next;
            cur.next= pre ;
            pre = cur;
            cur = temp;
        }

        return pre;

    }
}
